<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Threaded 类</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="pthreads.constants.html">« 预定义常量</a></li>
      <li style="float: right;"><a href="threaded.chunk.html">Threaded::chunk »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.pthreads.html">pthreads</a></li>
    <li>Threaded 类</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.threaded" class="reference">

 <h1 class="title">Threaded 类</h1>
 

 <div class="partintro"><p class="verinfo">(PECL pthreads &gt;= 2.0.0)</p>


  <div class="section" id="threaded.intro">
   <h2 class="title">简介</h2>
   <p class="para">
  Threaded 对象提供支持 pthreads 操作的基本功能，包括同步方法以及其他对程序员很有帮助的接口。
   </p>
   <p class="para">
    重要的是，Threaded 提供了隐式的线程安全机制，这个对象中的所有操作都是线程安全的。
   </p>
  </div>


 <div class="section" id="threaded.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">Threaded</strong>
     </span>
     
     <span class="oointerface"><span class="modifier">implements</span> 
       <a href="class.collectable.html" class="interfacename">Collectable</a></span><span class="oointerface">,  <a href="class.traversable.html" class="interfacename">Traversable</a></span><span class="oointerface">,  <a href="class.countable.html" class="interfacename">Countable</a></span><span class="oointerface">,  <a href="class.arrayaccess.html" class="interfacename">ArrayAccess</a></span> {</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="threaded.chunk.html" class="methodname">chunk</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$size</code></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$preserve</code></span>): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.count.html" class="methodname">count</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.extend.html" class="methodname">extend</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="thread.isrunning.html" class="methodname">isRunning</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.isterminated.html" class="methodname">isTerminated</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span><span class="methodname"><a href="threaded.merge.html" class="methodname">merge</a></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$from</code></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$overwrite</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.notify.html" class="methodname">notify</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.notifyone.html" class="methodname">notifyOne</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.pop.html" class="methodname">pop</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.run.html" class="methodname">run</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.shift.html" class="methodname">shift</a></span>(): <span class="type">boolean</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.synchronized.html" class="methodname">synchronized</a></span>(<span class="methodparam"><span class="type"><a href="class.closure.html" class="type Closure">Closure</a></span> <code class="parameter">$block</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="threaded.wait.html" class="methodname">wait</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>

   }</div>


  </div>

 </div>

 




















































































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="threaded.chunk.html">Threaded::chunk</a> — 操作</li><li><a href="threaded.count.html">Threaded::count</a> — 操作</li><li><a href="threaded.extend.html">Threaded::extend</a> — Runtime Manipulation</li><li><a href="thread.isrunning.html">Threaded::isRunning</a> — 状态检测</li><li><a href="threaded.isterminated.html">Threaded::isTerminated</a> — 状态检测</li><li><a href="threaded.merge.html">Threaded::merge</a> — 操作</li><li><a href="threaded.notify.html">Threaded::notify</a> — 同步控制</li><li><a href="threaded.notifyone.html">Threaded::notifyOne</a> — Synchronization</li><li><a href="threaded.pop.html">Threaded::pop</a> — 操作</li><li><a href="threaded.run.html">Threaded::run</a> — 执行</li><li><a href="threaded.shift.html">Threaded::shift</a> — Manipulation</li><li><a href="threaded.synchronized.html">Threaded::synchronized</a> — 同步控制</li><li><a href="threaded.wait.html">Threaded::wait</a> — Synchronization</li></ul>
</div>
</div></div></body></html>